import instance from '../../utils/request.js'

// 头像上传
export const uploadAvatarAPI = (data) => {
  const { userId, imgFile } = data
  return instance({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: `/api/upload/avatar`,
    method: 'POST',
    data: { userId, imgFile }
  })
}   

// 新闻封面
export const uploadNewsCoverAPI = (data) => {
  const { newsId, imgFile } = data
  return instance({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: `/api/upload/newsCover`,
    method: 'POST',
    data: { newsId, imgFile }
  })
}

// 通知封面
export const uploadInfoCoverAPI = (data) => {
  const { infoId, imgFile } = data
  return instance({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: `/api/upload/infoCover`,
    method: 'POST',
    data: { infoId, imgFile }
  })
}